Socket
Socket
Sign inDemoInstall

http-status

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

http-status

Interact with HTTP status code


Version published
Weekly downloads
504K
decreased by-0.53%
Maintainers
1
Weekly downloads
 
Created

What is http-status?

The http-status npm package provides a collection of HTTP status codes and their associated messages. It is useful for setting and interpreting HTTP response statuses in web applications.

What are http-status's main functionalities?

Accessing Status Codes

You can easily access standard HTTP status codes using the package. This is useful for setting response statuses in your web server.

const httpStatus = require('http-status');
console.log(httpStatus.OK); // 200
console.log(httpStatus.NOT_FOUND); // 404

Accessing Status Messages

The package allows you to retrieve the standard message associated with a given status code. This can be useful for logging or displaying human-readable status messages.

const httpStatus = require('http-status');
console.log(httpStatus['200']); // 'OK'
console.log(httpStatus['404']); // 'Not Found'

Custom Status Codes

You can add custom status codes and messages to the http-status object. This is useful if your application uses non-standard status codes.

const httpStatus = require('http-status');
httpStatus['999'] = 'Custom Status';
console.log(httpStatus['999']); // 'Custom Status'

Other packages similar to http-status

Keywords

FAQs

Package last updated on 17 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc